package cn.tedu.stu;
/*
   封装学生类:私有化封装+get/set方法+toString方法
   注意：此类名中的属性必须和前端表单name的属性值一致。先后顺序必须一致
 */
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Arrays;
import java.util.Date;
//注意:: 日期属性要加注解,@DateTimeFormat(pattern="yyyy-MM-dd")，否则400错误 ;需要使用注解进行类型转换.并指定日期格式:
public class Student {
    //必须与表单的参数一致;采用引用类型进行封装
    private  String name;//姓名
    private  Integer age;//年龄
    private  String sex;//性别
    private  String[] hobby;//爱好【数组】
    private  String edu;//学历
    @DateTimeFormat(pattern = "yyyy-MM-dd")  //【特殊格式】
    private Date intime;//入学时间

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String[] getHobby() {
        return hobby;
    }

    public void setHobby(String[] hobby) {
        this.hobby = hobby;
    }

    public String getEdu() {
        return edu;
    }

    public void setEdu(String edu) {
        this.edu = edu;
    }

    public Date getIntime() {
        return intime;
    }

    public void setIntime(Date intime) {
        this.intime = intime;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", sex='" + sex + '\'' +
                ", hobby=" + Arrays.toString(hobby) +
                ", edu='" + edu + '\'' +
                ", intime=" + intime +
                '}';
    }
}

